﻿using UnityEngine;
using UnityEditor;
using PureMVC.Patterns;
using PureMVC.Interfaces;
using OrderSystem;

public class ModifyCookStateCommand : SimpleCommand
{
    public override void Execute(INotification notification)
    {
        base.Execute(notification);

        CookProxy proxy = Facade.RetrieveProxy(CookProxy.NAME) as CookProxy;

        CookItem cookItem = notification.Body as CookItem;
        Order order = cookItem.curOrder;
        ClientItem clientItem = order.client;
        if (cookItem.state==E_CookState.MakeFood)
        {
            //通知服务员上菜
            SendNotification(OrderSystemEvent.UPDATE_WAITER_GET_FOOD, clientItem);
            proxy.modifyCookItemState(notification.Body as CookItem);//做完菜 更新厨师的状态。
        }
        else
        {
            proxy.modifyCookItemState(notification.Body as CookItem);//做完菜 更新厨师的状态。
        }
    }
}